package cc.vvshop.demo2;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

/**
 * Created by tomas on 16-6-16.
 */
@Repository
public class AccountDaoImpl implements AccountDao {


    @Autowired
    private JdbcTemplate jdbcTemplate;

    public void outMoney(String name, Integer money) {
        String sql="update account set money= money-? where name =?";
        jdbcTemplate.update(sql,money,name);
    }

    public void inMoney(String name, Integer money) {
        String sql="update account set money= money+? where name =?";
        jdbcTemplate.update(sql,money,name);
    }
}
